<?php

namespace common\models\db\tables;

use Yii;

/**
 * This is the model class for table "{{%products}}".
 *
 * @property int $id
 * @property int $created_at
 * @property int $updated_at
 * @property int $deleted_at
 * @property int $created_by_admin
 * @property int $updated_by_admin
 * @property int $status 1正常2下架
 * @property string $name
 * @property string $cover
 * @property int $cate_root
 * @property int $product_sort
 * @property int|null $sheff_on_at 上架时间
 * @property int|null $sheff_off_at 下架时间
 * @property string|null $specs 规格
 * @property string|null $model_num 型号
 * @property string|null $hnumbering 货号
 */
class Products extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%products}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['created_at', 'updated_at', 'deleted_at', 'created_by_admin', 'updated_by_admin', 'status', 'name', 'cover', 'cate_root', 'product_sort', 'sheff_on_at', 'sheff_off_at', 'specs', 'model_num', 'hnumbering'], 'trim'],
            [['created_at', 'updated_at', 'created_by_admin', 'updated_by_admin', 'name', 'cover', 'cate_root'], 'required'],
            [['created_at', 'updated_at', 'deleted_at', 'created_by_admin', 'updated_by_admin', 'status', 'cate_root', 'product_sort', 'sheff_on_at', 'sheff_off_at'], 'integer'],
            [['name', 'cover', 'specs', 'model_num', 'hnumbering'], 'string', 'max' => 180],
            [['deleted_at'], 'default', 'value' => 0],
            [['status', 'product_sort'], 'default', 'value' => 1],
            [['sheff_on_at', 'sheff_off_at', 'specs', 'model_num', 'hnumbering'], 'default', 'value' => null],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_at' => Yii::t('app', 'Updated At'),
            'deleted_at' => Yii::t('app', 'Deleted At'),
            'created_by_admin' => Yii::t('app', 'Created By Admin'),
            'updated_by_admin' => Yii::t('app', 'Updated By Admin'),
            'status' => Yii::t('app', '1正常2下架'),
            'name' => Yii::t('app', 'Name'),
            'cover' => Yii::t('app', 'Cover'),
            'cate_root' => Yii::t('app', 'Cate Root'),
            'product_sort' => Yii::t('app', 'Product Sort'),
            'sheff_on_at' => Yii::t('app', '上架时间'),
            'sheff_off_at' => Yii::t('app', '下架时间'),
            'specs' => Yii::t('app', '规格'),
            'model_num' => Yii::t('app', '型号'),
            'hnumbering' => Yii::t('app', '货号'),
        ];
    }
}
